package com.game.ammo {
	import com.game.data.Data;
	import com.game.units.Enemy;
	import com.game.utils.TowerType;
	
	import flash.filters.BlurFilter;
	import flash.geom.Matrix;
	import flash.geom.Point;
	import flash.geom.Rectangle;

	public class Slow extends Ammo {
		private var position:Number = 0;
		private var currentPosition:Point;
		private var ammoSize:Number = 5;
		public function Slow(bulX:Number, bulY:Number, ang:Number, destination:Number, type:TowerType,upgrades:int,suggestiveDistance:int) {
			super(bulX, bulY, ang, destination, type,upgrades,suggestiveDistance);
		}
		override public function isHit(p3:Enemy):Boolean {
			if (pointToPointDistance(p3, currentPosition) < p3.size/2 + ammoSize) {
				return true;
			}
			return false;
		}
		override protected function hitAction():void {
			readyForRemoval = true;
			move();
		}
		override protected function initialSet():void {
			ammoSpeed = 10;
			this._damage=(upgrades+2)
			currentPosition = new Point(0, 0);
			//
			position=Data.STEP/2;
			_rect.width=20;
			_rect.height=20;
		}
		override public function move():void {
			if (position > destination) {
				readyForRemoval = true;
			}
			position += this.ammoSpeed;
			currentPosition.x = -position * Math.cos(this._angle) + this.x;
			currentPosition.y = -position * Math.sin(this._angle) + this.y;
			_point.x=currentPosition.x-10;
			_point.y=currentPosition.y-10;
			
		}
	}
}